package com.yunxi.module.system.framework.datapermission;

import com.yunxi.framework.datapermission.core.rule.dept.DeptDataPermissionRuleCustomizer;
import com.yunxi.module.system.model.dept.DeptDO;
import com.yunxi.module.system.model.user.AdminUserDO;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * <p>
 * system 模块的数据权限 Configuration
 * </p>
 *
 * @author lidy
 * @since 2024-05-19
 */
@Configuration(proxyBeanMethods = false)
public class DataPermissionConfiguration {

    @Bean
    public DeptDataPermissionRuleCustomizer sysDeptDataPermissionRuleCustomizer() {
        return rule -> {
            // DeptSimpleRespVO
            rule.addDeptColumn(AdminUserDO.class);
            rule.addDeptColumn(DeptDO.class, "id");
            // user
            rule.addUserColumn(AdminUserDO.class, "id");
        };
    }
}
